package com.fr.report.web;

import com.fr.base.ArrayUtils;
import com.fr.base.ColumnRow;
import com.fr.base.core.ComparatorUtils;
import com.fr.base.xml.XMLPrintWriter;
import com.fr.base.xml.XMLableReader;
import com.fr.report.io.xml.SynchronizedFrozenColumnRow;
import java.awt.Color;

public class WebWrite extends WebContent
{
  public static final String EVENT_BEFORE_VERIFY_WRITE = "beforeverifywrite";
  public static final String EVENT_AFTER_VERIFY_WRITE = "afterverifywrite";
  public static final String EVENT_AFTER_VERIFY = "afterverify";
  public static final String EVENT_BEFORE_WRITE = "beforewrite";
  public static final String EVENT_AFTER_WRITE = "afterwrite";
  public static final String EVENT_WRITE_SUCCESS = "writesuccess";
  public static final String EVENT_WRITE_FAILURE = "writefailure";
  public static final String EVENT_BEFORE_APPEND = "beforeappend";
  public static final String EVENT_AFTER_APPEND = "afterappend";
  public static final String EVENT_BEFORE_DELETE = "beforedelete";
  public static final String EVENT_AFTER_DELETE = "afterdelete";
  private Color selectedColor = new Color(102, 231, 255);

  public Color getSelectedColor()
  {
    return this.selectedColor;
  }

  public void setSelectedColor(Color paramColor)
  {
    this.selectedColor = paramColor;
  }

  public String getColor()
  {
    return "rgb(" + this.selectedColor.getRed() + "," + this.selectedColor.getGreen() + "," + this.selectedColor.getBlue() + ")";
  }

  public String[] supportedEvents()
  {
    return ((String[])ArrayUtils.addAll(super.supportedEvents(), new String[] { "afterverify", "beforeverifywrite", "afterverifywrite", "beforewrite", "afterwrite", "writesuccess", "writefailure", "beforeappend", "afterappend", "beforedelete", "afterdelete" }));
  }

  public boolean equals(Object paramObject)
  {
    if (!(paramObject instanceof WebWrite))
      return false;
    return ((ComparatorUtils.equals(((WebWrite)paramObject).listenerList, this.listenerList)) && (ComparatorUtils.equals(((WebWrite)paramObject).selectedColor, this.selectedColor)));
  }

  public void readXML(XMLableReader paramXMLableReader)
  {
    super.readXML(paramXMLableReader);
    if (paramXMLableReader.isChildNode())
    {
      String str;
      if (paramXMLableReader.getTagName().equals("FrozenColumnRow"))
        if ((str = paramXMLableReader.getAttr("columnrow")) != null)
        {
          ColumnRow localColumnRow = ColumnRow.valueOf(str);
          if (ColumnRow.validate(localColumnRow))
            SynchronizedFrozenColumnRow.putSynchronizedFrozenColumnRow(localColumnRow);
        }
      else if (paramXMLableReader.getTagName().equals("SelectedColor"))
        if ((str = paramXMLableReader.getAttr("color")) != null)
          setSelectedColor(new Color(Integer.parseInt(str), true));
        else
          setSelectedColor(null);
    }
  }

  public void writeXML(XMLPrintWriter paramXMLPrintWriter)
  {
    super.writeXML(paramXMLPrintWriter);
    paramXMLPrintWriter.startTAG("SelectedColor");
    if (this.selectedColor != null)
      paramXMLPrintWriter.attr("color", this.selectedColor.getRGB());
    paramXMLPrintWriter.end();
  }
}